/**
* 系统管理 菜单管理
*/
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/reports' }">
        报告管理
      </el-breadcrumb-item>
      <el-breadcrumb-item>实验报告</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 主体内容 -->
    <div ref="content">
      <div class="title-box">
        <span class="rpt-title">{{ rptData.title }}</span>
        <span class="rpt-info">{{ rptData.name }}-{{rptData.grade}}</span>
      </div>
      <el-form label-width="120px" :model="rptData" ref="rptData">
        <el-form-item label="实验入参说明">
          <el-input size="small" v-model="rptData.params" :disabled="true">
          </el-input>
        </el-form-item>
        <el-form-item label="实验区域数据">
          <img width="200px" :src="rptData.srcimg" alt="预览图片" />
        </el-form-item>
        <el-form-item label="实验调用算法">
          <el-input v-model="rptData.algorithm" :disabled="true">
          </el-input>
        </el-form-item>
        <el-form-item label="实验结果预览">
          <img width="200px" :src="rptData.disimg" alt="预览图片" />
        </el-form-item>
        <el-form-item label="实验最终结论">
          <el-input type="textarea" :rows="3" v-model="rptData.conclusion" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="教师批改意见">
          <el-input type="textarea" :rows="3" v-model="rptData.comment" :disabled="true"></el-input>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" :loading="loading" class="title" @click="download()">
          下载报告
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        loading: false, //是显示加载
        editFormVisible: false, //控制编辑页面显示与隐藏
        rptData: {},
      };
    },
    /**
     * 创建完毕
     */

    created() {
      let rptId = this.$route.query.rptId;
      this.loading = true;
      this.$axios.get("/reports/info/" + rptId + "/").then((res) => {
        this.loading = false
        this.rptData = res.data.results;
        if (!this.rptData) {
          this.$message.error('报告加载失败，请稍后再试！')
        }

      }).catch(err => {
        this.loading = false
        this.$message.error('报告加载失败，请稍后再试！')
      });

    },

    mounted() {

    },

    /**
     * 里面的方法只有被调用才会执行
     */
    methods: {

      download() {
        this.$PDFSave(this.$refs['content'], this.rptData.title + '-' + this.rptData.name + '-' + this.rptData.grade)
      }

    },
  };
</script>

<style>
  .user-search {
    margin-top: 20px !important;
  }

  .user-search td {
    margin-top: 20px !important;
  }

  .userRole {
    width: 100%;
  }

  .el-table__expanded-cell {
    padding: 0px !important;
    margin: 0px !important;
  }

  .title-box {
    width: 100%;
    height: 60px;
    line-height: 60px;
    background-color: #f0f2f5;
    text-align: center;
    color: #334157;
    margin-top: 20px;
    margin-bottom: 20px;
    border: #334157 solid 1px;
  }

  .rpt-title {
    font-size: 36px;
  }

  .rpt-info {
    font-size: 18px;
  }


  .treeclass {
    border: 1px solid #f3f3f3;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .selectw {
    width: 100%;
  }

  .tableStyle {
    margin-top: 20px;
  }

  .dialog-footer {
    display: flex;
    justify-content: center;
  }
</style>